{template 'common/header'}
<script>
    $(function(){
        $(".del-user").click(function(){
            var uid = $(this).attr('uid');
            if(confirm("是否确定删除用户？")){
                var url = "{php echo $this->createWebUrl('system',array('op' => 'del_user'))}";
                $.ajax({
                    type : "post",
                    url : url,
                    data : {'uid' : uid},
                    success : function(data){
                        if(data == 111){
                            location.reload();
                        }
                    }
                });
            }
        });
    });
</script>
<ul class="nav nav-tabs">
    <li class="active" ><a href="{php echo $this->createWebUrl('system', array('op'=>'index'))}">账号管理</a></li>
    <li ><a href="{php echo $this->createWebUrl('system', array('op' => 'add'))}">新建账号</a></li>
    <li ><a href="{php echo $this->createWebUrl('system', array('op'=>'department'))}">部门管理</a></li>
</ul>
<div>
    <div>
        <table class="table">
            <tr>
                <th>账号</th>
                <th>部门</th>
                <th>操作码</th>
                <th>操作</th>
            </tr>
            {loop $users $user}
            <tr>
                <td>{$user['username']}</td>
                <td>{$user['department']}</td>
                <td>{$user['code']}</td>
                <td>
                    <a href="{php echo $this->createWebUrl('system',array('op' => 'add', 'uid' => $user['uid']))}">
                        <button class="btn btn-default">修改</button>
                    </a>
                    <button class="btn btn-danger del-user" uid="{$user['uid']}">删除</button>
                    <a href="index.php?c=module&a=permission&do=post&uid={$user['uid']}&m=ljr_shipping">
                        <button class="btn btn-primary">权限</button>
                    </a>
                </td>
            </tr>
            {/loop}
        </table>
    </div>
</div>



{template 'common/footer'}